package mat;

import java.util.HashMap;

import jcifs.smb.SmbFile;

public class SmbFileAttribute
{
	protected HashMap<Integer, String> mapNames = new HashMap<Integer, String>();
	
	public SmbFileAttribute()
	{
		mapNames.put(SmbFile.ATTR_ARCHIVE, "A");
		mapNames.put(SmbFile.ATTR_DIRECTORY, "D");
		mapNames.put(SmbFile.ATTR_HIDDEN, "H");
		mapNames.put(SmbFile.ATTR_READONLY, "R");
		mapNames.put(SmbFile.ATTR_SYSTEM, "S");
		mapNames.put(SmbFile.ATTR_VOLUME, "V");
	}
	
	public String getDescription(int value)
	{
		String res = mapNames.get(value);
		if (res != null)
			return res;
		
		res = "";
		for (Integer i : mapNames.keySet())
		{
			if ((i.intValue() & value) == i.intValue())
			{
				res += mapNames.get(i);
			}
		}
		if (res.length() > 0)
			return res;
		
		return Integer.toString(value);
	}
	
}
